package com.guigu.controller.lq.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.controller.lq.mapper.LqPsychologyjgMapper;
import com.guigu.controller.lq.pojo.LqPhysicaljg;
import com.guigu.controller.lq.pojo.LqPsychologyjg;
import com.guigu.controller.lq.pojo.PageVO;
import com.guigu.controller.lq.service.LqPsychologyjgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LqPsychologyjgServiceimpl implements LqPsychologyjgService {
    @Autowired
    LqPsychologyjgMapper lqPsychologyjgMapper;

    public PageVO<LqPsychologyjg> find(Integer page, Integer num, String vipname) {
        PageHelper.startPage(page,num);
        LqPsychologyjg lqPsychologyjg = new LqPsychologyjg();
        lqPsychologyjg.setVipname(vipname);
        List<LqPsychologyjg> findjg = lqPsychologyjgMapper.findjg(lqPsychologyjg);
        PageInfo<LqPsychologyjg> pageInfo = new PageInfo<LqPsychologyjg>(findjg);
        long total = pageInfo.getTotal();
        PageVO<LqPsychologyjg> PageVO = new PageVO<LqPsychologyjg>();
        PageVO.setTotal(total);
        PageVO.setRows(findjg);
        return PageVO;
    }

    public int xladd(LqPsychologyjg lqPhysicaljg) {
        return lqPsychologyjgMapper.insert(lqPhysicaljg);
    }

    public LqPsychologyjg selid(Integer id) {
        return lqPsychologyjgMapper.selid(id);
    }

    public int xlup(LqPsychologyjg lqPhysicaljg) {
        return lqPsychologyjgMapper.updateByPrimaryKey(lqPhysicaljg);
    }

    public int xldel(Integer id) {
        return lqPsychologyjgMapper.deleteByPrimaryKey(id);
    }

    public List<LqPsychologyjg> findfs() {
        return lqPsychologyjgMapper.findfs();
    }

    public List<LqPsychologyjg> findxl(String vipid) {
        return lqPsychologyjgMapper.findxl(vipid);
    }
}
